package com.ycy.chuwenuniapp.controller;

import com.ycy.chuwenuniapp.common.ResData;
import com.ycy.chuwenuniapp.dto.GoodsDetailDto;
import com.ycy.chuwenuniapp.entity.AdminKey;
import com.ycy.chuwenuniapp.entity.User;
import com.ycy.chuwenuniapp.service.AdminKeyService;
import com.ycy.chuwenuniapp.service.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "管理员秘钥管理")
@RequestMapping("/adminKey")
@RestController
public class AdminKeyController {
    @Resource
    private AdminKeyService adminKeyService;

    @PostMapping("/save")
    @ApiOperation("新增或修改")
    public ResData<Boolean> saveAdminKey(@RequestBody AdminKey entity) {
        return adminKeyService.saveAdminKey(entity);
    }


    @GetMapping("/check")
    @ApiOperation("验证管理员秘钥")
    public ResData<Boolean> checkKey(String secretKey,String userId) {
        return adminKeyService.checkKey(secretKey, userId);
    }
}
